import request from "./request";

// 获取轮播图列表
const carouselsList = (pageNumber = 1, pageSize = 10) => {
    return request.get('/api/carousels', {
        params: {
            pageNumber,
            pageSize
        }
    });
};

// 获取轮播图详细信息
const carouselsInfo = (carouselsId = 0) => {
    return request.get(`/api/carousels/${carouselsId}`);
};

// 新增轮播图信息
const carouselsInsert = (body) => {
    return request.post('/api/carousels', body);
};

// 修改轮播图信息
const carouselsUpdate = (body) => {
    return request.put('/api/carousels', body);
};

// 删除轮播图信息
const carouselsRemove = (ids = []) => {
    return request('/api/carousels', {
        method: 'DELETE',
        data: {
            ids
        }
    });
};

/////////////////////////////////////

//获取热销商品配置列表
const hotShopsList = (pageNumber = 1, pageSize = 10,configType=3) => {
    return request.get('/api/indexConfigs', {
        params: {
            pageNumber,
            pageSize,
            configType
        }
    });
};

//获取热销商品详细信息
// const hotShopsInfo = (carouselsId = 0) => {
//     return request.get(`/api/indexConfigs/${carouselsId}`);
// };

// 新增热销商品信息
const hotShopsInsert = (body) => {
    return request.post('/api/indexConfigs', body);
};

// 修改热销商品信息
const hotShopsUpdate = (body) => {
    return request.put('/api/indexConfigs', 
        body
    
    );
};

// 删除热销商品信息
const hotShopsRemove = (ids = []) => {
    return request('/api/indexConfigs', {
        method: 'DELETE',
        data: {
            ids
        }
    });
};

///////////////////////////////////

//获取新品上新配置列表
const newShopsList = (pageNumber = 1, pageSize = 10,configType=4) => {
    return request.get('/api/indexConfigs', {
        params: {
            pageNumber,
            pageSize,
            configType
        }
    });
};

//////////////////////////////////////

//获取为你推荐配置列表
const recommendList = (pageNumber = 1, pageSize = 10,configType=5) => {
    return request.get('/api/indexConfigs', {
        params: {
            pageNumber,
            pageSize,
            configType
        }
    });
};

export default {
    carouselsList,
    carouselsInfo,
    carouselsInsert,
    carouselsUpdate,
    carouselsRemove,
    hotShopsList,
    // hotShopsInfo,
    hotShopsInsert,
    hotShopsUpdate,
    hotShopsRemove,
    newShopsList,
    recommendList
};